<?php
/**
 * Created by PhpStorm.
 * User: lijie
 * Date: 2018/10/26
 * Time: 14:49
 */
namespace app\reserve\model;


use think\Model;

class UserAddress extends Model {

    protected $table = 'orange_useraddress';

    protected $autoWriteTimestamp=true;
    protected $createTime = "ctime";
    protected $updateTime = "utime";
    protected $dateFormat;

    /**
     * Notes: 添加用户地址
     * Create Date: 2018/10/26
     * Create by :lijie
     */
    public function addAddress($save)
    {
        return $this->isUpdate(false)->save($save);
    }

    /**
     * Notes: 删除用户地址
     * Create Date: 2018/10/26
     * Create by :lijie
     */
    public function delAddress($param)
    {
        return $this->save(['status'=>9],$param);
    }

    /**
     * Notes:  编辑用户地址
     * Create Date: 2018/10/26
     * Create by :lijie
     */
    public function editAddress($param,$w)
    {
        return $this->save($param,$w);
    }

    /**
     * Notes: 查询用户地址
     * Create Date: 2018/10/26
     * Create by :lijie
     */
    public function selectAddress($w,$pagenum,$listNum)
    {
        return $this->where($w)->order("ctime desc")->page($pagenum,$listNum)->select();
    }

    /**
     * Notes: 查询用户地址
     * Create Date: 2018/10/26
     * Create by :lijie
     */
    public function findAddress($param)
    {
        return $this->where($param)->find();
    }
}